﻿using System.Collections.Generic;
using Ops.Host.Core.Models;
using Ops.Host.Core.Services;

namespace Ops.Host.App.ViewModels;

public sealed class AlarmRecordViewModel : SinglePagedViewModelBase<AlarmRecord, AlarmRecordFilter>
{
    private readonly IAlarmRecordService _alarmRecordService;

    public AlarmRecordViewModel(IAlarmRecordService alarmRecordService)
    {
        _alarmRecordService = alarmRecordService;

        InitSearch();
    }

    public override string DownloadFileName()
    {
        return "警报记录" + base.DownloadFileName();
    }

    protected override (IEnumerable<AlarmRecord> items, long pageCount) OnSearch(int pageIndex, int pageSize)
    {
        return _alarmRecordService.GetPaged(QueryFilter, pageIndex, pageSize);
    }
}
